package patrol.mobile.com.mobilepatrol.activity.security.adapter;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyCuringCheck3Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyProtectCheckActivity;
import patrol.mobile.com.mobilepatrol.bean.Curing1Bean;

/**
 * Created by K on 2018/9/11.
 * des:
 */
public class EmergencyCuring1ListAdapter extends BaseQuickAdapter<Curing1Bean> {
    public EmergencyCuring1ListAdapter(Context context) {
        super(context);
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_emergency_curing1_list;
    }

    @Override
    protected void convert(BaseViewHolder holder, final Curing1Bean item) {
        holder.setText(R.id.tv_num, (holder.getLayoutPosition() + 1) + "");
        holder.setText(R.id.tv_worksUnit, item.getWorksUnit());
        holder.setText(R.id.tv_proWorks, item.getProWorks());
        holder.setText(R.id.tvNum, "项目数量: " + item.getNum());
        holder.setText(R.id.tvCreateDate, item.getCreateDate());
        holder.setText(R.id.tv_auditName, TextUtils.isEmpty(item.getAuditName()) ? "正常" : item.getAuditName());

        holder.setOnClickListener(R.id.rl_root, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, EmergencyCuringCheck3Activity.class);
                intent.putExtra("id", item.getId());
                mContext.startActivity(intent);
            }
        });

//        holder.getView(R.id.tv_details).setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                mContext.startActivity(new Intent(mContext, EmergencyDrill3Activity.class));
//            }
//        });
    }
}
